package com.audaque.springboot.foshanupload.core.util.ssl.model;



import java.io.Serializable;
import java.util.function.Predicate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;

public class AnyHostnameVerifier implements HostnameVerifier, Serializable {
    private static final long serialVersionUID = 1L;
    private Predicate<String> predicate;

    public AnyHostnameVerifier(Predicate<String> predicate) {
        this.predicate = predicate;
    }

    public boolean verify(final String hostname, final SSLSession session) {
        return this.predicate != null ? this.predicate.test(hostname) : true;
    }
}
